package com.qianxing.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;

@Configuration
public class CommonMultipartFileConfig {
    //将CommonsMultipartResolver注册到容器中
    @Bean(name = "multipartResolver")
    public CommonsMultipartResolver getCommonsMultipartResolver() {
        CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver();
        multipartResolver.setMaxUploadSize(20971520); //最大内存大小
        multipartResolver.setMaxInMemorySize(1024); //上传文件最小限制
        return multipartResolver;
    }
}
